﻿<UserControl x:Class="Epi.WPF.Controls.DataDisplayControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../ResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
    <DataGrid x:Name="dataGridMain" 
                         ItemsSource="{Binding Path=., IsAsync=True, FallbackValue=...}"   
                         ColumnHeaderHeight="25"
                         AutoGenerateColumns="True"
              BorderThickness="0"              
              EnableRowVirtualization="True" 
              EnableColumnVirtualization="True"
              VirtualizingStackPanel.IsVirtualizing="True"
              VirtualizingStackPanel.VirtualizationMode="Recycling"
              CanUserAddRows="False"
              CanUserDeleteRows="False"
              CanUserReorderColumns="True"
              CanUserResizeColumns="True"
              CanUserResizeRows="False"
              CanUserSortColumns="False"
              VerticalGridLinesBrush="{DynamicResource windowBorderColor}"
              HorizontalGridLinesBrush="{DynamicResource windowBorderColor}"
              SelectionUnit="CellOrRowHeader" CellEditEnding="dataGridMain_CellEditEnding" BeginningEdit="dataGridMain_BeginningEdit" Loaded="dataGridMain_Loaded" AutoGeneratedColumns="dataGridMain_AutoGeneratedColumns">
            <DataGrid.ColumnHeaderStyle>
                <Style TargetType="DataGridColumnHeader">
                    <Setter Property="Background" Value="White" />
                    <Setter Property="BorderThickness" Value="0,0,1,1" />
                    <Setter Property="BorderBrush" Value="{DynamicResource windowBorderColor}" />                    
                    <Setter Property="Padding" Value="4" />
                    <Setter Property="HorizontalAlignment" Value="Stretch" />
                    <Setter Property="VerticalAlignment" Value="Stretch" />
                </Style>
            </DataGrid.ColumnHeaderStyle>
                <DataGrid.CellStyle>                
                <Style TargetType="DataGridCell">
                    <Style.Triggers>
                        <Trigger Property="IsSelected"
                        Value="True">
                            <Setter Property="Background"
                        Value="{DynamicResource windowDarkColor}" />
                            <Setter Property="Foreground"
                        Value="White" />
                            <Setter Property="BorderBrush"
                        Value="Black" />
                            <Setter Property="BorderThickness"
                        Value="1" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.CellStyle>
        </DataGrid>
    </Grid>
</UserControl>
